layui.use(['form', 'jquery', 'layer',  'table'], function() {
	var form = layui.form;
	var $ = layui.$;
	var table = layui.table;
	var layer = layui.layer;

	table.render({
		elem: '#product_list',
		url: '/erp/product/ajax_product.html',
		method:'post',
		cellMinWidth: 80,
		height:'full-140',
		where:{_o:'title',_b:'desc'},
		size:'sm',
		cols: [
			[{
					field: 'id',
					width: 80,
					title: 'ID',
					type:'checkbox',
					fixed:'left'
				}, {
					field: 'title',
					width: 300,
					title: '产品名称',
					sort: true
				}
			]
		],
		page:{layout:['count','first','prev', 'page', 'next','last','skip'],limit:30,theme:'#393d49',groups:8},
		initSort:{field:'title',type:'desc'}
	});
	// 排序
	table.on('sort(product_list)',function(data){
		var _o = data.field;
		var _b = data.type;
		table.reload('product_list',{
			initSort:data,
			where:{
				_o:_o,
				_b:_b
			}
		})
	})
})